﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;

namespace Ymca.Web.Models.Account
{
    public class RegisterViewModel
    {
        private const string _usernamePattern = @"[A-Za-z0-9]+(?:[@. _-][A-Za-z0-9]+)*";
        private const string _emailPattern = @"^([\w\.\-]+)@([\w\-]+)((\.(\w){2,3})+)$";

        [Required]
        [Display(Name = "User name")]
        [StringLength(60,MinimumLength=3)]
        [RegularExpression(_usernamePattern)]
        public string Username { get; set; }

        [Required]
        [Display(Name = "Email")]
        [RegularExpression(_emailPattern)]
        public string Email { get; set; }

        [Required]
        [Display(Name = "Password")]
        [StringLength(60, MinimumLength=6)]
        public string Password { get; set; }

        [Required]
        [Display(Name = "Confirm password")]
        [Compare("Password")]
        public string ConfirmPassword { get; set; }
    }
}